//package org.langqiao.jvm.base;
//
//import java.net.MalformedURLException;
//import java.net.URL;
//import java.net.URLClassLoader;
//import java.sql.Connection;
//import java.sql.SQLException;
//import java.util.Properties;
//
//import com.mysql.jdbc.Driver;
//
//public class URLClassLoaderTest {
//	
//	private static Connection conn;
//	
//	public static Connection getConn(String url , String user , String pass) throws MalformedURLException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException{
//		if(conn == null){
//			URL[] urls = {new URL("file:mysql-connector-java-5.1.21-bin.jar")};
//			URLClassLoader myClassLoader = new URLClassLoader(urls);
//			//加载mysql的jdbc驱动
//			Driver driver = (Driver) myClassLoader.loadClass("com.mysql.jdbc.Driver").newInstance();
//			Properties prop = new Properties();
//			prop.setProperty("user", user);
//			prop.setProperty("password", pass);
//			conn = driver.connect(url, prop);
//		}
//		return conn;
//	}
//	
//	public static void main(String[] args) throws MalformedURLException, InstantiationException, IllegalAccessException, ClassNotFoundException, SQLException {
//		System.out.println(getConn("jdbc:mysql://localhost:3306/test", "root", "root"));
//	}
//
//}
